package com.zhong.gang.applib.dialog;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.zhong.gang.applib.R;
import com.zhong.gang.applib.base.dialog.BaseDialog;
import com.zhong.gang.applib.databinding.DialogSlideBinding;

public abstract class SlideDialog extends BaseDialog<DialogSlideBinding> {

    protected onSlideListener listener;

    public void setListener(onSlideListener listener) {
        this.listener = listener;
    }

    public SlideDialog(@NonNull Context context) {
        super(context);
    }

    @Override
    public int LayoutRes() {
        return R.layout.dialog_slide;
    }

    @Override
    public void initView() {
        bind.setDialog(this);
    }

    @Override
    public double proportion() {
        return 1;
    }

    @Override
    public int Gravity() {
        return Gravity.BOTTOM;
    }

    public void onViewClicked(View view){
        dismiss();
        if (view.getId() == R.id.tx_finish)
            finish();
    }

    public abstract void finish();

    public interface onSlideListener<T>{
        void onSlideBack(T data);
    }
}
